﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebsiteUI.Extensions;
using WebEntities;
using com.subb.WebInformation;

namespace WebsiteUI.Controllers
{
    /// <summary>
    /// 资讯动态 栏目
    /// </summary>
    public class NewsController : Controller
    {
        [OutputCache(CacheProfile = "Cache15Mins")]
        public ActionResult Index()
        {
            WI_NewsDAL ndal = new WI_NewsDAL();
            //获取通知公告前2条
            //List<WI_News> bulList = CommonFn.GetNews("BulletinID", "NewsPage_Bulletin", 0, 2, 600);
            List<WI_News> bulList = ndal.GetAllNews(CommonFn.GetContentID("BulletinID"), 0, 20);
            ViewBag.BulletinID = CommonFn.GetContentID("BulletinID");
            ViewBag.BulletinList = bulList;

            //获取协会动态前20条
            //List<WI_News> unionNewsList = CommonFn.GetNews("UnionNewsID", "NewsPage_UnionNews", 0, 20, 600);
            List<WI_News> unionNewsList = ndal.GetAllNews(CommonFn.GetContentID("UnionNewsID"), 0, 20);
            ViewBag.UnionNewsID = CommonFn.GetContentID("UnionNewsID");
            ViewBag.UnionNewsList = unionNewsList;

            //获取行业信息前20条
            //List<WI_News> induNewsList = CommonFn.GetNews("IndustryNewsID", "NewsPage_IndustryNews", 0, 20, 600);
            List<WI_News> induNewsList = ndal.GetAllNews(CommonFn.GetContentID("IndustryNewsID"), 0, 20);
            ViewBag.IndustryNewsID = CommonFn.GetContentID("IndustryNewsID");
            ViewBag.IndustryNewsList = induNewsList;

            //获取知识专栏前5条
            //List<WI_News> knowList = CommonFn.GetNews("KnowledgeID", "", 0, 5, 600);
            List<WI_News> knowList = ndal.GetAllNews(CommonFn.GetContentID("KnowledgeID"), 0, 20);
            ViewBag.KnowledgeID = CommonFn.GetContentID("KnowledgeID");
            ViewBag.KnowList = knowList;

            //获取会务展览信息前8条
            //List<WI_News> meetList = CommonFn.GetNews("MeetingID", "", 0, 8, 600);
            List<WI_News> meetList = ndal.GetAllNews(CommonFn.GetContentID("MeetingID"), 0, 20);
            ViewBag.MeetingID = CommonFn.GetContentID("MeetingID");
            ViewBag.MeetingList = meetList;

            //获取教育培训信息前3条
            //List<WI_News> trainList = CommonFn.GetNews("TrainingID", "", 0, 3, 600);
            List<WI_News> trainList = ndal.GetAllNews(CommonFn.GetContentID("TrainingID"), 0, 20);
            ViewBag.TrainingID = CommonFn.GetContentID("TrainingID");
            ViewBag.TrainingList = trainList;

            //获取协会会刊前6条
            List<WI_News> mookList = ndal.GetAllNews(CommonFn.GetContentID("UnionMookID"), 0, 20);
            ViewBag.UnionMookID = CommonFn.GetContentID("UnionMookID");
            ViewBag.UnionMookList = mookList;

            return View();
        }
    }
}
